<div class="page-content">
    <div class="col-sm-6 pull-right">
        <button class="btn btn-sm btn-primary pull-right" onclick="javascript:window.location.href = 'index'">
            返回列表
            <i class="icon-reply icon-only"></i>
        </button>
    </div>
    <div class="page-header">
        <h1>
            {:model('menu')->getParentNname()}
            <small>
                <i class="ace-icon fa fa-angle-double-right"></i>
                {:input('id')?'编辑':'新增'}
            </small>
        </h1>
    </div><!-- /.page-header -->

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <form class="form-horizontal" role="form" action="{:input('id')?'siteInfo':'siteInfo'}" method="post" enctype="multipart/form-data" name="myfrom" >
                {:input('id')?'<input type="hidden" value="'.$info['id'].'" name="id">':''}

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">名字:</label>
                    <div class="col-sm-9">
                        <input type="text" class="col-xs-10 col-sm-5" value="{$info.name|default=''}" name="title"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">Logo图片:</label>
                    <div class="col-sm-9">
                        <div class="input-append">
                            <input type="file" style="display: none" class="form-control file" name="image_url" id="thisfile" value="{$info.image_url|default=''}">

                            <!-- 用于展示上传文件名的表单 -->
                            <input id="showname" value="{$info.logo|default=''}"  type="text" style="height: 40px;width: 150px;">
                            <!-- 点击触发按钮 -->
                            <a class="btn btn-primary" style="height: 40px" onclick="makeThisfile()" id="browse">浏览</a>
                        </div>
                    </div>
                </div>


                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="button" onclick="myfrom.submit()">
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            提交
                        </button>
                        &nbsp; &nbsp; &nbsp;
                        <button class="btn" type="reset">
                            <i class="ace-icon fa fa-undo bigger-110"></i>
                            重置
                        </button>
                    </div>
                </div>
            </form>
            <!-- PAGE CONTENT ENDS -->
        </div><!-- /.col -->
    </div><!-- /.row -->
</div><!-- /.page-content -->

<script type="text/javascript">
    $(function () {
        $(".dr").click(function () {
            var str = $("#thisfile").val();
            if (str == '') {
                alert('要导入的东西不能为空');
                return false;
            }
        })
    })

    function makeThisfile() {
        $('#thisfile').click();
    }

    //file表单选中文件时,让file表单的val展示到showname这个展示框
    $('#thisfile').change(function () {
        $('#showname').val($(this).val())
    })
</script>
<style type="text/css">
    #browse {
        border: 1px solid #ccc;
        border-radius: 4px;
        background-color: #2c9a8a;
        color: #fff;
    }
</style>